package dao.mapper.auth;

import model.auth.Authorities;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.mybatis.spring.annotation.Mapper;

@Mapper("auth.AuthoritiesCrudMapper")
public interface AuthoritiesCrudMapper {

	@Select("select seq_a_authorities.nextval from dual")
	long selectKey();
	
	@Insert("insert into a_authorities (id, authname, authdesc, enabled, issys) " +
			"values (#{m.id}, #{m.authname}, #{m.authdesc}, #{m.enabled}, #{m.issys})")
	int insert(@Param("m") Authorities model);
	
	@Select("select * from a_authorities where id=#{id} ")
	Authorities getById(@Param("id") Long id);

	@Select("select * from a_authorities where id=#{id} and enabled=#{enabled}")
	Authorities getValidById(@Param("id") Long id, @Param("enabled") Integer enabled);
	
	@Delete("delete from a_authorities where id=#{id}")
	int deleteById(@Param("id") Long id);
	
}
